<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>   
<link href="/${initParam.context_root }/css/starter-template3.css" rel="stylesheet">

<div class="container">
	<div class="starter-template" style="padding-right: 40px; padding-top: 40px; padding-bottom: 80px" >
	<!--  테이블  Ui 처리  -->
		<h2>자유게시판</h2>
		
		<table class="table table-hover" cellpadding='0' cellspacing='0'>
			<thead>
			<tr>
				<td width="65px"><strong>글번호</strong></td>
				<td><strong>제목</strong></td>
				<td width="100px"><strong>작성자</strong></td>
				<td width="100px"><strong>작성일</strong></td>
				<td width="60px"><strong>조회수</strong></td>
			</tr>
			<c:forEach items="${requestScope.list }" var="board">
				<tr>
					<td>${board.no }</td>
					<td><c:forEach begin="1" end="${board.relevel }" step="1">
							&nbsp;&nbsp;
						</c:forEach><c:if test="${board.relevel != 0 }">
							→
						</c:if><a
								href="/${initParam.context_root}/com/getContent.do?no=${board.no }&page=${requestScope.pagingBean.currentPage}">
							${board.title }</a></td>
					<td><a onclick="javascript:popUpProfileByNickname('${board.nickname }');">${board.nickname }</a></td>
					<td>${board.writedate }</td>
					<td align="right">${board.viewcount }</td>
				</tr>	
			</c:forEach>
			</thead>
		</table>
		<div align="right"><a href="/${initParam.context_root }/com/write_form.do" class="btn btn-primary" role="button">글쓰기</a></div>
		
		<p><!-- 페이징 빈 ui처리 -->
			<nav>
				<ul class="pagination">		
					<c:choose>
						<c:when test="${requestScope.pagingBean.previousPageGroup }">
							<li class="disabled"><a
							href="/${initParam.context_root  }/com/list.do?page=${requestScope.pagingBean.startPageOfPageGroup -1 }"><span aria-hidden="true">&laquo;
							</span><span class="sr-only">◀</span></a></li><!-- Previous -->
						</c:when>
					<c:otherwise>
						<li class="disabled"><a href="#"><span aria-hidden="true">&laquo;</span><span
												class="sr-only">◀</span></a></li><!-- Previous -->
					</c:otherwise>
					</c:choose>
					<c:forEach begin="${requestScope.pagingBean.startPageOfPageGroup }"
										   end="${requestScope.pagingBean.endPageOfPageGroup }"
										   step="1"
										   var ="i">
						<c:choose>
							<c:when test="${i == requestScope.pagingBean.currentPage }">
							<li class="active"><a href="#">${i } <span class="sr-only">(current)</span></a></li>
							</c:when>
							<c:otherwise>
								<li><a href="/${initParam.context_root }/com/list.do?page=${i }">${i }<span class="sr-only">(current)</span>
									</a></li>
							</c:otherwise>
						</c:choose>			
					</c:forEach>
					<c:choose>
						<c:when test="${requestScope.pagingBean.nextPageGroup }">
							<li><a href="/${initParam.context_root  }/com/list.do?page=${requestScope.pagingBean.endPageOfPageGroup + 1 }"><span
										aria-hidden="true">&raquo;</span><span class="sr-only">▶</span></a></li><!-- Next -->
						</c:when>
					<c:otherwise>
						<li class="disabled"><a href="#"><span aria-hidden="true">&raquo;</span><span
									class="sr-only">▶</span></a></li><!-- Next -->		
					</c:otherwise>
				</c:choose>
			</ul>
		</nav>
	</div>
</div>